package com.slz3.business.module.systemManagement.sysOrganize.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.systemManagement.sysOrganize.domain.SysOrganize;
import com.slz3.business.module.systemManagement.sysOrganize.domain.SysOrganizeFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class SysOrganizeTransactionalServiceImpl implements SysOrganizeTransactionalService {

    @Override
    public SysOrganize modify(SysOrganize sysOrganizeNew) {
        Repositorys.sysOrganize.test();
        Repositorys.sysOrganize.save(SysOrganizeFactory.initBaseFields());
        System.err.println(1/0);
        sysOrganizeNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.sysOrganize.saveAndFlush(sysOrganizeNew);
    }

    @Override
    public List<SysOrganize> batchModify(List<SysOrganize> sysOrganizeList) {
        return Repositorys.sysOrganize.saveAll(sysOrganizeList);
    }
}
